set term pngcairo dashed truecolor font "Arial, 10" size 850, 530  enhanced crop
set output "kernel.nscaling.png"

set grid lt 1 lw 0.5 lc rgb "#DDDDDD"

set key top left

unset mxtics
unset mx2tics

unset mytics
unset my2tics

set logscale x
set logscale y
set logscale x2
set logscale y2

set format x "%.0f"
set format x2 "10^{%T}"

set format y "%g"
#set format y2 "10^{%T}"


set  xtics nomirror (4**3, 8**3, 16**3, 32**3, "262.144" 64**3, "2.097.152" 128**3, "16.777.216 " 256**3, "134.217.728 " 512**3, "  1.073.741.824" 1024**3)
set x2tics 100, 10, 1024**3

set ytics  0.01, 10, 10000 nomirror
#set ytics  0.01, 10, 10000
set y2tics ("1 sec" 1.0, "1 min" 60, "1 hour" 3600)
set xlabel "number of particles"
set ylabel "time" offset 2

set label 1 at 600, 90 "gsize = 180^3\ngstep = 3\n"

k=0.0000075
alpha=1
f(x)= k*x**alpha
fit [32**3:512**3] f(x) "kernel.nscaling.magny-login.txt" u 2:3 via k, alpha

set label 2 at 4e6, 0.6 sprintf("%.0f particles/sec", (1/k)**(1/alpha)) tc rgb "#AAAAAA"

plot [64:1024**3][0.01:10000] \
f(x) w l lw 3 lt 1 lc rgb "#EEEEEE" t sprintf("%.2e N^{%g}", k, alpha), \
"kernel.nscaling.magny-login.txt" u 2:3 w l lt 2 lc 1 t "magny-login","" u 2:3 w p pt 7 ps 2 lc 1 t "","" u 2:3:8 w labels offset 0,2 t "","" u 2:3:7 w labels offset 0,-2.9 t "", \
"kernel.nscaling.magny.nehalem-01.txt" u 2:3 w l lt 2 lc 3 t "magny.nehalem-01", "" u 2:3 w p pt 7 ps 2 lc 3 t "",\
"kernel.nscaling.desktop.linuxvm.txt" u 2:3 w l lt 2 lc 2 t "desktop.linuxvm", "" u 2:3 w p pt 7 ps 2 lc 2 t ""


print f(10240**3)/86400/10000, " days"

print (1/k)**(1/alpha)


